/************************************************************
 * Project Name         [Thinking_In_Java]
 * File Name            [FormatMenu.java]
 * Creation Date        [11-Jul-2014]
 * 
 * Copyright© ge.y.yang@gmail.com All Rights Reserved
 * 
 * Work hard, play harder, think big and keep fit
 ************************************************************/
package pkg_02_gui.notepad_V1.ui.format;

import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;

import javax.swing.JMenu;
import javax.swing.JMenuItem;

/**
 * 格式菜单
 * 
 * @author 不落的太阳(Sean Yang)
 * @version 1.0
 * @since JDK 6
 * 
 */
public abstract class FormatMenu extends JMenu {

	private static final long serialVersionUID = -5595534083640832205L;

	private final ActionListener listener = null;

	/** **********************格式菜单*********************** */
	private JMenuItem wordWrapItem; // 自动换行菜单项
	private JMenuItem fontItem;// 字体菜单项

	/**
	 * 初始化格式菜单
	 * 
	 * @param menuName
	 */
	private void initFormatMenu() {
		// 格式菜单
		this.setMnemonic(KeyEvent.VK_O); // 设置快捷键为Alt+O

		wordWrapItem = new JMenuItem("自动换行(W)"); // 自动换行菜单项
		wordWrapItem.setMnemonic('W'); // 设置激活键为W
		wordWrapItem.addActionListener(listener);
		this.add(wordWrapItem);

		fontItem = new JMenuItem("字体(F)");// 字体菜单项
		fontItem.setMnemonic('F'); // 设置激活键为F
		fontItem.addActionListener(listener);
		this.add(fontItem);
	}

	public FormatMenu() {
		super();
	}

	public FormatMenu(String menuName) {
		super(menuName);
		initFormatMenu();
	}

	public JMenuItem getWordWrapItem() {
		return wordWrapItem;
	}

	public JMenuItem getFontItem() {
		return fontItem;
	}
}
